using Demo.Store.HttpApi.Host;
using Serilog;
using Serilog.Events;

Log.Logger = new LoggerConfiguration()
#if DEBUG
    .MinimumLevel.Debug()
#else
                .MinimumLevel.Information()
#endif
    .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
    .Enrich.FromLogContext()
    .WriteTo.Async(c => c.File("Logs/logs.txt"))
#if DEBUG
    .WriteTo.Async(c => c.Console())
#endif
    .CreateLogger();

var builder = WebApplication.CreateBuilder(args);

builder.Host.UseAutofac().UseSerilog();

builder.Services.ReplaceConfiguration(builder.Configuration);

builder.Services.AddApplication<DemoStoreHttpApiHostModule>();



var app = builder.Build();

app.InitializeApplication();

app.Run();